#ifndef __UTILS2_H__
#define __UTILS2_H__

#include "utils.h"

#define bufferSize(p)	((p)->bufPtr-(p)->buffer)
#define clearBuffer(p)	((p)->bufPtr=(p)->buffer)

void closeStream(FILE *iSvrResp);


int avialible(int fd, int timeout);

int fAvialible(FILE *f, int timeout);

void xorEncode(char *buf, int size, char *key, int keySize);

int bufferEncrypt(char *buf, int size, char *target, int targetSize, char *key, int keySize);

int bufferDecrypt(char *buf, int size, char *target, int targetSize, char *key, int keySize);

char *fileDecryptSelf(char *fname, char *key, int keySize);

char *loadFileMem(char *fname, int *fsize, int encrypt, char *key, int keySize);

#define loadFile(f, size) loadFileMem(f, size, 0, NULL, 0);

#endif
